// ---------------------------------------------------------------------------
// Campari Software
//
// FileDownloadCompletedEventArgs.cs
//
// Provides the delegate and associated derived EventArgs class used to provide
// the calling code a way to specify the callback to be used when the
// DownloadDataCompleted event.
//
// ---------------------------------------------------------------------------
// Copyright (C) 2006-2007 Campari Software
// All rights reserved.
//
// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY
// OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT
// LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR
// FITNESS FOR A PARTICULAR PURPOSE.
// ---------------------------------------------------------------------------
using System;
using System.ComponentModel;

namespace Nojin.Netwwork.Download
{
    /// <summary>
    /// Provides data for the <see cref="FileDownloader.DownloadCompleted"/> event.
    /// </summary>
    public class FileDownloadCompletedEventArgs : EventArgs
    {
        #region Fields
        private bool canceled;
        private Exception error;
        private string result;
        #endregion

        #region Constructors
        internal FileDownloadCompletedEventArgs(string result, Exception error, bool canceled)
            : base()
        {
            this.result = result;
            this.error = error;
            this.canceled = canceled;
        }
        #endregion

        #region Properties

        #region Canceled
        /// <summary>
        /// Gets a value indicating if the download operation was cancelled.
        /// </summary>
        /// <value><see langword="true"/> if the download was cancelled; otherwise,
        /// <see langword="false"/>.</value>
        public bool Canceled
        {
            get
            {
                return this.canceled;
            }
        } 
        #endregion

        #region Error
        /// <summary>
        /// Gets a value indicating which error occurred during a download
        /// operation.
        /// </summary>
        /// <value>The <see cref="Exception"/> that occurred.</value>
        public Exception Error
        {
            get
            {
                return this.error;
            }
        }
        #endregion

        #region Result
        /// <summary>
        /// Gets a value indicating the destination file for the download
        /// operation.
        /// </summary>
        /// <value>A <see cref="String"/> representing the destination file.</value>
        public string Result
        {
            get
            {
                return this.result;
            }
        }
        #endregion     

        #endregion
    }
}